﻿<Window x:Class="SEToolbox.Views.WindowChangeOwner"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:commands="clr-namespace:SEToolbox.Services"
        xmlns:converters="clr-namespace:SEToolbox.Converters"
        xmlns:controls="clr-namespace:SEToolbox.Controls"
        ResizeMode="NoResize" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" WindowStyle="ThreeDBorderWindow"
        Title="Change owner" Height="260" Width="320" Icon="/SEToolbox;component/app.ico" Style="{StaticResource DefaultWindowStyle}"
        commands:DialogService.IsRegisteredView="True"
        commands:DialogCloser.DialogResult="{Binding CloseResult}"
        FocusManager.FocusedElement="{Binding ElementName=UxInitialElement}">
    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
        <converters:BusyMouseConverter x:Key="BusyMouseConverter" />
    </Window.Resources>
    <Window.Cursor>
        <Binding Path="IsBusy" Converter="{StaticResource BusyMouseConverter}"/>
    </Window.Cursor>
    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid Margin="8,8,8,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="60"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="0" Grid.Column="0" Text="Player:" VerticalAlignment="Top"/>
                <ListBox Grid.Row="0" Grid.Column="1" Name="UxInitialElement" HorizontalAlignment="Stretch" ItemsSource="{Binding PlayerList}" SelectedValue="{Binding SelectedPlayer}" IsTextSearchEnabled="True" DisplayMemberPath="DisplayName"/>
            </Grid>
            <StackPanel Grid.Row="1" Orientation="Horizontal" Height="28" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,8,8,8">
                <Button Width="90" Command="{Binding ChangeCommand}" Content="Change" IsDefault="True"/>
                <Button Margin="8,0,0,0" Width="90" Command="{Binding CancelCommand}" Content="Cancel" IsCancel="True"/>
            </StackPanel>
        </Grid>
        <controls:BusyIndicator Visibility="{Binding IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}" />
    </Grid>
</Window>
